package com.funny.controller;

import com.funny.entity.OrderProduction;
import com.funny.service.RedisService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author Ming
 * @description
 * @fileSimpleName PointController
 * @fileName com.funny.controller.PointController
 * @date 2024年07月04日 18:29
 */
@Slf4j
@RestController
@RequestMapping(value = "/point")
public class PointController {

    @Autowired
    private RedisService redisService;

    @PostMapping("/add")
    public String add() {
        log.info("下单成功");
        String message = redisService.getCacheObject("Ming");
        return "Point Hello World :7024 sentinel服务：" + System.currentTimeMillis() + message;
    }

    @PostMapping("/addPoint")
    public String addPoint(@RequestBody OrderProduction production) {
        log.info("add point success 下单成功");
        String message = redisService.getCacheObject("Ming");
        return "add point success" + System.currentTimeMillis() + production.getProductionName();
    }

    @PostMapping("/addPoint2")
    public String addPoint2(@RequestParam("productionName") String productionName) {
        log.info("add point success! 商品名称：{}", productionName);
        String message = redisService.getCacheObject("Ming");
        return "add point success! 商品名称：" + productionName + ",当前时间：" + System.currentTimeMillis();
    }

}
